﻿using System;
using System.Collections.Generic;

namespace AppMain
{
    public class DynamicBox3D : Box3D
    {
        public DynamicBox3D(float sizeX, float sizeY, float sizeZ, float posX, float posY, float posZ) : base(sizeX, sizeY, sizeZ, posX, posY, posZ)
        {

        }

        public DynamicBox3D(float sizeX, float sizeY, float sizeZ, float posX, float posY, float posZ, float offsetX, float offsetY, float offsetZ) : base(sizeX, sizeY, sizeZ, posX, posY, posZ, offsetX, offsetY, offsetZ)
        {
        }

        public DynamicBox3D(float[] sizeLst, float[] offsetLst, float posX, float posY, float posZ) : base(sizeLst, offsetLst, posX, posY, posZ)
        {

        }
        public DynamicBox3D(Box3D source) : base(source)
        {

        }

        public void updatePos(float posX, float posY, float posZ)
        {
            this.posX = posX;
            this.posY = posY;
            this.posZ = posZ;
        }

        protected float cacheSizeY = 0;
        private bool transverse = false;
        public bool Transverse
        {
            set
            {
                if (transverse != value)
                {
                    transverse = value;
                    exchangeXY();
                }
            }
        }
        /// <summary>
        /// 平躺
        /// </summary>
        private void exchangeXY()
        {
            if (this.transverse)
            {
                this.cacheSizeY = this.sizeY;
                this.sizeY = this.sizeX;
            }
            else
            {
                this.sizeY = this.cacheSizeY;
            }
        }

    }

}
